//2.
#include<stdio.h>
struct student
{
	int num;
	char name[10];
	float score[5];
};
float STU(struct student *p,int n)
{
	float sum = 0;
	register int i = 0,j = 0;
	for(i = 0; i < n; i++)
	{
		for(j = 0; j < 3; j++)
		{
			(p+i)->score[3] += ((p+i)->score[j]);
		}
		sum += (p+i)->score[3];
		(p+i)->score[4] = (p+i)->score[3] / 3;
	}
	float aver = sum / n;
	return aver;
}
int main()
{
	struct student manage[] = {
					{10001,"hua",{63.5f,75.6f,85.3f}},
					{10002,"liu",{99.9f,88.8f,77.7f}},
					{10003,"fan",{45.6f,68.9f,86.7f}}
				  };
	int n = sizeof manage / sizeof manage[0];
	float aver = STU(manage,n);
	float max = manage[0].score[3];
	int flag = 0;
	register int i = 0,j = 0;
	for(i = 1; i < n; i++)
	{
		if(manage[i].score[3] > max)
		{
			max = manage[i].score[3];
			flag = i;
		}
	}
	printf("成绩最高学生为%s，总成绩为%f\n",manage[flag].name,manage[flag].score[3]);
	for(i = 0; i < n; i++)
	{
		printf("同学%s,总分为%f,平均分为%f\n",manage[i].name,manage[i].score[3],manage[i].score[4]);
		if(manage[i].score[4] > aver)
		{
		printf("同学%s,平均分为%f大于总平均分%f\n",manage[i].name,manage[i].score[4],aver);
		}
	}
	return 0;
}
